<!--{if $payform.online}-->
<!-- <h3>{$lang.connecting_pay_gateway}</h3> -->
<form action="{$payform.gateway}" id="payform" method="{$payform.method}" style="display:none">
	<!-- {foreach from=$payform.params item=value key=_k} -->
	<input type="hidden" name="{$_k}" value="{$value}" />
	<!-- {/foreach} -->
</form>
<script type="text/javascript">
      //document.getElementById('payform').submit();
      
  </script> 
  <script type="text/javascript">

		//调用微信JS api 支付
		function jsApiCall()
		{
			WeixinJSBridge.invoke(
				'getBrandWCPayRequest',
				{$payform.params},
				function(res){
					 if(res.err_msg == "get_brand_wcpay_request:ok" ) {
					     location.href = "index.php?app=paynotify&order_id={$order.order_id}";
					 	//location.href = "http://m.zimaozhigou.com/mobile/index.php?app=buyer_order&act=view&order_id={$order.order_id}";
					 }else{
					 	alert('支付失败或您手动取消了支付！请重新支付！');
					 	location.href = "index.php?app=buyer_order";
					 }
				}
			);
		}

		function callpay()
		{
			if (typeof WeixinJSBridge == "undefined"){
			    if( document.addEventListener ){
			        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
			    }else if (document.attachEvent){
			        document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
			        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
			    }
			}else{
			    jsApiCall();
			}
		}
		callpay();
	</script>
{else}
{include file="header.html"}
<div id="page-cashier">
	<div class="page-main">
		<div class="payment-desc">
			<h3>{$lang.payment_desc}</h3>
			<div class="detail"> {$payform.desc} </div>
		</div>
		<form id="pay_message_form" action="mobile/index.php?app=cashier&act=offline_pay&order_id={$order.order_id}" method="POST">
			<table class="table_form" width="100%" border="0" cellspacing="0" cellpadding="5">
				<tr>
					<td valign="top"> {$lang.input_pay_message} <span class="desc">({$lang.input_pay_message_notice})</span></td>
				</tr>
				<tr>
					<td><textarea name="pay_message">{$order.pay_message|escape}</textarea></td>
				</tr>
				<tr>
					<td><a href="javascript:;" onclick="$('#pay_message_form').submit();" class="btn">确认支付</a></td>
				</tr>
			</table>
		</form>
	</div>
</div>
{include file="footer.html"} 
<!--{/if}--> 
